<?php
$categories = $mvc->getObject(CategoryService::CATEGORY);
$subcategories = $mvc->getObject(SubCategoryService::SUBCATEGORY);
$regions = $mvc->getObject(RegionService::REGIONS);
$countries = $mvc->getObject(CountryService::COUNTRY);
$errors = $mvc->getObject(TradesmanContentController::ERROR);
?>
<h2>_i18n{New Bargain}</h2>
<form action="new-bargain.html" method="post" enctype="multipart/form-data">
<div class="unitABlock">
<?php if (isset($errors )){?>
	<div class="itemWarning">
		<ul>
			<li><?php echo $errors ?></li>
		</ul>
	</div>
<?php } ?>
	<div class="unitSnColumn">
		<div class="itemForm">
			<label>_i18n{Title}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="bargain_name" value="<? if(isset($_POST['bargain_name'])) echo $_POST['bargain_name']; ?>"/>
			</div>
		</div>
		<div class="itemForm">
			<label>_i18n{Description}:</label>
			<div class="itemData">
				<textarea class="areaTxt" name="bargain_desc"><? if(isset($_POST['bargain_desc'])) echo $_POST['bargain_desc']; ?></textarea>
			</div>
		</div>
	</div>
	<div class="unitEqColumn">
		<div class="itemForm">
			<label>_i18n{Category}:</label>
			<div class="itemData">
				<select name="category_id" class="gCategory">
<?php			if (isset($categories) && $categories!=NULL){ 
					foreach($categories as $key=>$category){ ?>
						<option value="<?php echo $category[CategoryService::ID] ?>"><?php echo $category[CategoryService::CAT_NAME] ?></option>
<?php 				} 
				} ?>
				</select>
			</div>
		</div>
		<div class="itemForm itemEq">
			<label>_i18n{SubCategory}:</label>
			<div class="itemData">
				<select name="subcategory_id" class="gSubCategory">
<?php			if (isset($subcategories) && $subcategories!=NULL){ 
					foreach($subcategories as $key=>$subcategory){ ?>						
						<option value="<?php echo $subcategory[SubCategoryService::ID] ?>"><?php echo $subcategory[SubCategoryService::SUBCAT_NAME] ?></option>
<?php 				} 
				} ?>
				</select>
			</div>
		</div>
	</div>
	<div class="unitEqColumn">
		<div class="itemForm">
			<label>_i18n{Usual Price}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="usual_price" value="<? if(isset($_POST['usual_price'])) echo $_POST['usual_price']; ?>"/>
			</div>
		</div>
		<div class="itemForm">
			<label>_i18n{Bargain Price}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="bargain_price" value="<? if(isset($_POST['bargain_price'])) echo $_POST['bargain_price']; ?>"/>
			</div>
		</div>
	</div>
	<div class="unitSnColumn">
		<div class="itemForm">
			<label>Number:</label>
			<div class="itemData">
				<input class="inpTxt" type="text"  name="number" value="<? if(isset($_POST['number'])) echo $_POST['number']; ?>"/>
			</div>
		</div>
		<div class="itemForm"> 
			<label>_i18n{Upload Pictures}:</label>
			<div class="itemData">
				<input type="file" name="bargain_image" value="<? if(isset($_POST['bargain_image'])) echo $_POST['bargain_image']; ?>"/>
			</div>
		</div>
	</div>
</div>
<div class="unitABlock unitABlockLast">
	<div class="unitEqColumn">
		<div class="itemForm">
			<label>_i18n{Country}:</label>
			<div class="itemData">
				<select name="country" >
<?php			if (isset($countries) && $countries!=NULL){ 
					foreach($countries as $key=>$country){ ?>						
						<option value="<?php echo $country[CountryService::ID] ?>"><?php echo $country[CountryService::COUNTRY_NAME] ?></option>
<?php 				} 
				} ?>
				</select>
			</div>
		</div>		
		<div class="itemForm">
			<label>_i18n{State}:</label>
			<div class="itemData">
				<select name="region" >
<?php			if (isset($regions) && $regions!=NULL){ 
					foreach($regions as $key=>$region){ ?>
						<option value="<?php echo $region[RegionService::ID] ?>"><?php echo $region[RegionService::REGION_NAME] ?></option>
<?php 				} 
				} ?>
				</select>
			</div>
		</div>		
		<div class="itemForm">
			<label>_i18n{City}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="city" value="<? if(isset($_POST['city'])) echo $_POST['city']; ?>"/>
			</div>
		</div>
	</div>
	<div class="unitEqColumn">
		<div class="itemForm">
			<label>_i18n{ZIP}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="zip" value="<? if(isset($_POST['zip'])) echo $_POST['zip']; ?>"/>
			</div>
		</div>
		<div class="itemForm">
			<label>_i18n{Street}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="street" value="<? if(isset($_POST['street'])) echo $_POST['street']; ?>"/>
			</div>
		</div>
		<div class="itemForm">
			<label>_i18n{Website}:</label>
			<div class="itemData">
				<input class="inpTxt" type="text" name="website" value="<? if(isset($_POST['website'])) echo $_POST['website']; ?>"/>
			</div>
		</div>
	</div>
	<div class="unitSnColumn">
		<div class="itemForm">
			<label>_i18n{Valid}</label>
			<div class="itemData">
				<label class="labelDate">_i18n{from}:</label>
				<input class="inpDate" type="text" name="from_date" value="<? if(isset($_POST['from_date'])) echo $_POST['from_date']; ?>"/>
				<label class="labelDate">_i18n{until}:</label>
				<input class="inpDate" type="text" name="until_date" value="<? if(isset($_POST['until_date'])) echo $_POST['until_date']; ?>"/>
			</div>
		</div>
	</div>
	<div class="unitBtn">
		<button name="save" value="1"><span><strong>_i18n{Save}</strong></span></button>
		<button name="back"><span><strong>_i18n{Discard}</strong></span></button>
	</div>
</div>
</form>